<template>
	<view>
<!-- 		<view class="content" v-for="(item,index) in consultDetailData" :key="index" @click="consultDetail(item.id)">
			<image class="img" :src="image+item.img" mode="aspectFill"></image>
			<view class="c">
				<view class="c1 onelineshow" >
					{{item.title}}
				</view>
				<view class="c2">
					<view>{{item.fb_time}}</view>
					<image src="/static/liulanliang.png" mode="widthFix"  style="width: 30rpx;"></image>
					<view>{{item.look}}</view>
					<image src="/static/dianzan.png" mode="widthFix" style="width: 30rpx;"></image>
					<view>{{item.is_dz}}</view>
				</view>
			</view>
		</view> -->
		<view class="padding text-bold text-xl text-center">
			{{consultDetailData[0].title}}
		</view>
		<view class="padding-sm">
			<view v-html="consultDetailData[0].content"></view>
		</view>
	</view>
</template>

<script>
	const app = getApp().globalData
	import {
		consultAPIDetail,
		giveProduct,
		qx_give_product
	} from '../../../common/path.js'
	export default {
		data() {
			return {
				consultDetailData: {},
				consultId: '',
				image:''
			}
		},
		onLoad(option) {
			console.log(option.id)
			this.consultId = option.id
			this.image = app.image
			this.consultAPIDetail(option.id)
		},
		methods: {
			consultAPIDetail() {
				let data = {
					id: this.consultId,
					user_id: app.userInfo.id
				}
				this.$axios.axios('POST', consultAPIDetail, data)
					.then(res => {
						console.log('获取咨询详情接口',res.data)
						if (res.status == 1) {
							this.consultDetailData = res.data
						}
					})
					.catch(err => {
						console.log(err)
					})
			},
			giveProduct() {
				let data = {
					user_id: app.userInfo.id,
					type_id: this.consultId
				}
				this.$axios.axios('POST', giveProduct, data)
					.then(res => {
						console.log(res.data)
						if (res.status == 1) {
							this.consultAPIDetail()
							this.$tools.showToast(res.msg)
						}else{
							this.$tools.showToast(res.msg)
						}
					})
					.catch(err => {
						console.log(err)
					})
			},
			setgiveProduct() {
				let data = {
					user_id: app.userInfo.id,
					type_id: this.consultId
				}
				this.$axios.axios('POST', qx_give_product, data)
					.then(res => {
						console.log(res.data)
						if (res.status == 1) {
							this.consultAPIDetail()
							this.$tools.showToast(res.msg)
						}else{
							this.$tools.showToast(res.msg)
						}
					})
					.catch(err => {
						console.log(err)
					})
			}

		}
	}
</script>

<style>
	.a {
		background-color: #F0F3F6;
		/* height: 1334rpx; */
	}

	.nav_adsgfg {
		/* color: #BBBBBB; */
		font-size: 26rpx;
		font-weight: bold;
	}

	.selectc {
		color: red;
		font-size: 26rpx;
		/* font-weight: bold; */
		/* border-bottom: 8rpx solid #86C133; */

	}

	.rowsb {
		font-size: 34rpx;
		background-color: #FFFFFF;
		margin-bottom: 20rpx;
		display: flex;
		justify-content: space-around;
	}

	.content {
		display: flex;
		margin-bottom: 20rpx;
	}

	.img {
		width: 200rpx;
		height: 200rpx;
		background-color: #eeeeee;
	}

	.c {
		width: 548rpx;
		padding: 15rpx;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		border-top: 1rpx solid #D3D3D3;
		border-bottom: 1rpx solid #D3D3D3;
		border-right: 1rpx solid #D3D3D3;
		background-color: #FFFFFF;
	}

	.c>.c1 {
		font-size: 32rpx;
	}

	.c>.c2 {
		display: flex;
		font-size: 30rpx;
		color: #666;
		align-items: center;
	}

	.c>.c2>image {
		margin: 0 15rpx;
	}

	.fuwenben {
		margin-top: 25rpx;
		padding: 25rpx;
	}
	page{
		background-color: white;
	}
</style>
